2020国产情侣在线视频播放_99久久精品自慰喷水_男人的天堂AV网站_精品久久久久中文字幕加勒比

 
????????INFO
???????CONTACT

???????????????????·?′???22??101

?綽??13592986386

jQuery AJAX??????????????????????λ?????? > jQuery AJAX???????????????

jQuery AJAX???????????????

???????2015/3/2 9:34:23

jQuery AJAX???????????????

1.???demo.aspx??檔
2.????????????????demos.aspx.cs????????á?

using System.Web.Services;
3.??????????????.
?????????????汾???????.net framework 2.0??2.0???2?????? ???????
[WebMethod] public static string SayHello()     
{ return "Hello Ajax!";     
}    
JS????
???????
$(function() {     
    $("#btnOK").click(function() {     
        $.ajax({ //???post???   type: "Post", //?????????????????   url: "Demo.aspx/SayHello",     
            contentType: "application/json; charset=utf-8",     
            dataType: "json",     
            success: function(data) { //???????????data.d???????   alert(data.d);     
            },     
            error: function(err) {     
                alert(err);     
            }     
        }); //???e??????   return false;     
    });     
});   
???????
??????
    <form id="form1" runat="server">
    <div>
        <asp:Button ID="btnOK" runat="server" Text="??????" />
    </div>
    </form>
????Ч?????£? 

3.?в???????????
???????
[WebMethod] public static string GetStr(string str, string str2)     
{ return str + str2;     
} 
JS????
???????
$(function() {     
    $("#btnOK").click(function() {     
        $.ajax({     
            type: "Post",     
            url: "demo.aspx/GetStr", //???????ε?д?????????str??βε?????,str2???????βε?????   data: "{'str':'????','str2':'XXX'}",     
            contentType: "application/json; charset=utf-8",     
            dataType: "json",     
            success: function(data) { //???????????data.d???????   alert(data.d);     
            },     
            error: function(err) {     
                alert(err);     
            }     
        }); //???e??????   return false;     
    });     
});    
???????
????Ч?????£?

4.???????鷽??
???????

???????
[WebMethod] public static List<string> GetArray()     
{     
    List<string> li = new List<string>(); for (int i = 0; i < 10; i++)     
        li.Add(i + ""); return li;     
}    
???????

JS????

???????
$(function() {     
    $("#btnOK").click(function() {     
        $.ajax({     
            type: "Post",     
            url: "demo.aspx/GetArray",     
            contentType: "application/json; charset=utf-8",     
            dataType: "json",     
            success: function(data) { //??????????ul   $("#list").html(""); //?????????   $(data.d).each(function() { //????????li????   $("#list").append("<li>" + this + "</li>");     
                });     
    
                alert(data.d);     
            },     
            error: function(err) {     
                alert(err);     
            }     
        }); //???e??????   return false;     
    });     
}); 
???????

??????

?
<form id="form1" runat="server">
<div>
    <asp:Button ID="btnOK" runat="server" Text="??????" />
</div>
<ul id="list">
</ul>
</form>

???н?????